﻿using System.Collections;

namespace RAP.Framework.Libary.DomTemplateBuilder.Handler.ArrayListActions
{
	/// <summary>
	/// 移除数组中指定内容的Handler
	/// </summary>
	public class RemoveActionHandler : ArrayListElementHandler
	{
		public override void DoAction ( IList list, object data )
		{
			var value = data.ToString ( ).Trim ( );
			for ( var i = list.Count - 1; i >= 0; i-- )
			{
				var val = list[i];
				if ( val != null && val.ToString ( ).Equals ( value ) )
				{
					list.RemoveAt ( i );
				}
			}
		}
	}
}
